package main

import (
	"bufio"
	"fmt"
	"net"
	"strings"
)

func main1() {

	listener, err := net.Listen("tcp", ":8080")
	if err != nil {
		panic(err)
	}

	for {
		conn, err := listener.Accept()
		if err != nil {
			continue
		}
		go handler_conn(conn)
	}

}

func handler_conn(conn net.Conn) {
	defer conn.Close()
	//io.WriteString(conn,"4545454")
	//conn.Write([]byte("788648"))
	//buf:=make([]byte,256)

	for {
		//n,err:=conn.Read(buf)
		//if err!=nil{
		//	fmt.Println(err.Error())
		//	break
		//}

		//log.Println(string(buf[:n]))
		r := bufio.NewReader(conn)
		data, _, _ := r.ReadLine()
		fmt.Println(string(data))
		if strings.TrimSpace(string(data)) == "stop" {
			break
		}

	}

}
